import md5 from 'js-md5'
export const signGengw = function (data){
	let ret = [];
	let str = '';
	let obj = {};
	let newObj = {}; //创建一个新的对象，用于存放排好序的键值对
	for (let item in data) {
	  ret.push(item.toLowerCase());
	  obj[item.toLowerCase()] = item;
	}
	ret.sort();
	for (let key in ret) {
	  let _key = obj[ret[key]];
	  if (typeof data[_key] != 'object' && _key!='productDesc' && _key!='productIntro' && _key!= 'bzImps') {
		newObj = data[_key];
		let res = typeof newObj == 'object'?'':newObj;
		if (str === '') {
			str = res=='' ? '' : _key + '=' + res;
		} else {
			str += '&' + _key + '=' + res;
		}
	  }
	}
	str += (data&&data!=''&&str!=''?'&':'') + 'key=' + '123456!@#$%^';

	let sign = md5(str).toUpperCase();
	// console.log("签名前：",str);
	// console.log("签名后：",sign);
	return Object.assign({sign}, data)
}
